<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const p1 = Promise.resolve(100)
        console.log('p1:',p1)


        p1.then( data => {
            console.log('data:',data)  // fulfilled状态触发then，不触发catch
        } ).catch( err => {
            console.log('err1:',err)
        } )
/////////////////////////////////////////////////////

        const p2 = Promise.reject('err')
        console.log('p2:',p2)


        p2.then( data => {
            console.log('data:',data) 
        } ).catch( err => {
            console.error('err2:',err)  // rejected状态下触发catch
        } )
    </script>
</body>
</html>